<!DOCTYPE html>
<html lang="ZC">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TAB</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #app {
            width: 100%;
            position: relative;
        }

        .tab {
            position: absolute;
            top: 50%;
            left: 35%;
            width: 600px;
            height: 70px;
            text-align: center;
            line-height: 70px;
        }

        ul {
            /* background-color: pink; */
            display: flex;
        }

        li {
            flex: 1;
            list-style: none;
            font-size: 18px;
            color: red;
            border: 1px solid #999999;
        }

        .active {
            background-color: orange;
        }

        .navitems {
            width: 600px;
            background-color: skyblue;
            display: none;
        }

        .navitems input {
            width: 300px;
            height: 40px;
            line-height: 40px;
            font-size: 22px;
        }

        .current {
            display: block;
        }
    </style>
    <script crossorigin="anonymous"
        integrity="sha512-BKbSR+cfyxLdMAsE0naLReFSLg8/pjbgfxHh/k/kUC82Hy7r6HtR5hLhobaln2gcTvzkyyehrdREdjpsQwy2Jw=="
        src="https://lib.baomitu.com/vue/2.6.12/vue.min.js"></script>
</head>

<body>
    <div id="app">
        <div class="tab">
            <ul>
                <li @click='change(index)' :class="currentIndex==index? 'active' : ''" :key='item.id'
                    v-for='(item,index) in tabList'>
                    {{item.title}}</li>
            </ul>
            <div :class="currentIndex==index? 'current' : ''" :key='item.id' v-for='(item,index) in tabList'
                class='navitems'>
                <input type="text" v-model='item.title'>
            </div>
        </div>
    </div>

    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                // 选项卡索引
                currentIndex: 0,
                tabList: [{
                    id: 1,
                    title: "秒杀"
                }, {
                    id: 2,
                    title: "优惠券"
                }, {
                    id: 3,
                    title: "PLUS会员"
                }, {
                    id: 4,
                    title: "品牌闪购"
                }, {
                    id: 5,
                    title: "拍卖"
                },]
            },
            methods: {
                change: function (index) {
                    // 切换
                    this.currentIndex = index;
                }
            }
        })
    </script>
</body>

</html>